package com.zlk.algorithm.huawei.nowcoder.string;

import java.io.*;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;

/**
 * @program: algorithm
 * @ClassName HJ59
 * @description:找出字符串中第一个只出现一次的字符
 * 输入描述：
 * 输入一个非空字符串
 * 输出描述：
 * 输出第一个只出现一次的字符，如果不存在输出-1
 * @author: slfang
 * @create: 2024-12-27 17:57
 * @Version 1.0
 **/
public class HJ59 {

    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        StreamTokenizer in = new StreamTokenizer(reader);
        PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
        while (in.nextToken()!=-1) {
            String str = (String) in.sval;
            char[] chars = str.toCharArray();
            LinkedHashMap<Character,Integer> countMap = new LinkedHashMap<>();
            for (int i = 0; i <chars.length ; i++) {
                char key = chars[i];
                if(!countMap.containsKey(key)){
                    countMap.put(key,1);
                }else{
                    countMap.put(key,countMap.get(key)+1);
                }
            }
            String ans = "-1";
            Set<Map.Entry<Character, Integer>> entries = countMap.entrySet();
            for (Map.Entry<Character, Integer> entry : entries) {
                if(entry.getValue()==1){
                    ans = ""+entry.getKey();
                    break;
                }
            }
            out.println(ans);
        }
        out.flush();
        out.close();
        reader.close();
    }


}
